package com.example.demo.service;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.example.demo.dao.HistoryRecordDao;
import com.example.demo.pojo.HistoryRecord;
import com.example.demo.pojo.User;

@Service("historyRecordService")
@Transactional
public class HistoryRecordServiceImpl implements HistoryRecordService {

	@Autowired
	private HistoryRecordDao historyDao;
	
	@Override
	public List<HistoryRecord> findUserHistoryRecord(HistoryRecord history) {
		// TODO Auto-generated method stub
		int returnMSG=0;
		List<HistoryRecord> msgFromDao=new ArrayList();
		System.out.println("�ӿ����������������ǣ�"+history);
		HistoryRecord historylist=new HistoryRecord();
		try {
			msgFromDao=historyDao.findUserHistoryRecord(history.getUserAccount());
			System.out.println("���ݿ�ķ��ؽ���ǣ�"+msgFromDao);
			if(msgFromDao!=null) {
				//�ɹ�����
				returnMSG=1;
			}else {
				//ʧ�ܲ���
				returnMSG=2;
			}
		} catch (Exception e) {
			//�쳣��������BUG��
			System.out.println("δ�ܲ��ҵ����û�");
			returnMSG=0;
			// TODO: handle exception
		}
		return msgFromDao;
	}

}
